package org.nicocube.airain.gwt.client.ui.item;

import java.util.LinkedList;
import java.util.List;

import com.google.gwt.user.client.ui.HTMLTable;
import com.google.gwt.user.client.ui.Label;

public class TableHeader {

	private static final String DaGridHeader = "daGridHeader";
	
	private List<String> cols;
	private String className;
	
	public TableHeader() {
		this(DaGridHeader);
	}
	
	public TableHeader(String className) {
		this.className = className;
		cols = new LinkedList<String>();
	}

	public TableHeader addCols(String txt) {
		cols.add(txt);
		return this;
	}
	
	public int size() {
		return cols.size();
	}
	
	public void render(HTMLTable g) {
		int i=0;
		for (String col : cols) {
			Label l = new Label(col);
			l.setStylePrimaryName(className);
			g.setWidget(0, i, l);
			i++;
		}
	}
}
